# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-r2pipe
pkgname=('python2-r2pipe' 'python-r2pipe')
_pkgname=r2pipe
pkgver=1.9.6
pkgrel=1
pkgdesc='Pipe interface for radare2.'
arch=('any')
url='https://pypi.org/project/r2pipe/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('5c30106656df7c330f29b3e58c2f8994cc55103796410880c3ac36922f0b8bac4399b82f51fcfb3ab0e50306370051644955b3d6487bc3e31749b547c79dc198')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-r2pipe() {
  depends=('python2')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-r2pipe() {
  depends=('python')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

